<?php 
error_reporting(0);
session_start();

function getRankImageName($rank)
{
	if($rank <= 45)
	{
		return "r".$rank;
	}
	else
	{
		return "ss".($rank - 45);
	}
}

require_once './classes/Auth.class.php';
require_once './includes/parselang.php';
require_once "./includes/dogtagsimg1.php";
require_once "./includes/rankdata.php";
require_once "./includes/weapondata.php";
require_once "./includes/vehicledata.php";

$cfg = parse_ini_file("./config.cfg");
$link = mysqli_connect($cfg['host'], $cfg['user'], $cfg['password'], $cfg['database']) or die("Error " . mysqli_error($link));

if(isset($_GET['user']))
{
	$pid = $_GET['user'];
}

//Get general player information from pid
$pidSQL = 'SELECT * FROM players WHERE `pid` = "'.$pid.'"';
$pidSQLResult = $link->query($pidSQL);
$userDataFromPid = mysqli_fetch_array($pidSQLResult, MYSQLI_ASSOC);

$weaponIDArray = array("c___kwa_g", "c_pTaur__kwa_g", "c_pTaurS__kwa_g", "c_sg870__kwa_g", "c_pM93R__kwa_g", "c_caA91__kwa_g", "c_wasK__kwa_g", "c_caACR__kwa_g", "c_arAEK__kwa_g", "c_arAK74__kwa_g", "c_caAKS__kwa_g", "c_arAN94__kwa_g", "c_smVAL__kwa_g", "c_arAUG__kwa_g", "c_sgDAO__kwa_g", "c_arF2__kwa_g", "c_arFAMAS__kwa_g", "c_wLATJAV__kwa_g", "c_wLAAFIM__kwa_g", "c_pG17__kwa_g", "c_pG17S__kwa_g", "c_pg18__kwa_g", "c_pg18S__kwa_g", "c_caG36__kwa_g", "c_arG3__kwa_g", "c_caHK53__kwa_g", "c_srJNG90__kwa_g", "c_arKH__kwa_g", "c_arL85A2__kwa_g", "c_mgL86A1__kwa_g", "c_srL96__kwa_g", "c_mgLSAT__kwa_g", "c_sgM1014__kwa_g", "c_arM16__kwa_g", "c_pM1911__kwa_g", "c_pM1911T__kwa_g", "c_pM1911S__kwa_g", "c_pM1911L__kwa_g", "c_mgM240__kwa_g", "c_mgM249__kwa_g", "c_wahUSG__kwa_g", "c_mgM27__kwa_g", "c_wahUGL__kwa_g", "c_srM39__kwa_g", "c_srM40__kwa_g", "c_arM416__kwa_g", "c_srHK417__kwa_g", "c_caM4__kwa_g", "c_smM5K__kwa_g", "c_mgM60__kwa_g", "c_pM9__kwa_g", "c_pM9S__kwa_g", "c_pM9F__kwa_g", "c_srM98__kwa_g", "c_mgMG36__kwa_g", "c_srMK11__kwa_g", "c_sgJackH__kwa_g", "c_pM412__kwa_g", "c_pMP443__kwa_g", "c_pMP443S__kwa_g", "c_pMP443L__kwa_g", "c_smMP7__kwa_g", "c_caMTAR21__kwa_g", "c_smP90__kwa_g", "c_smPDR__kwa_g", "c_mgPech__kwa_g", "c_smPP19__kwa_g", "c_smPP2000__kwa_g", "c_mgQBB95__kwa_g", "c_mgQBU88__kwa_g", "c_mgQBZ95B__kwa_g", "c_wLATRPG__kwa_g", "c_mgRPK__kwa_g", "c_wLAAIGL__kwa_g", "c_sgSaiga__kwa_g", "c_caSCAR__kwa_g", "c_arSCARL__kwa_g", "c_caSG553__kwa_g", "c_srSKS__kwa_g", "c_wLATSMAW__kwa_g", "c_sgSPAS12__kwa_g", "c_srSV98__kwa_g", "c_srSVD__kwa_g", "c_mgT88__kwa_g", "c_smUMP__kwa_g", "c_sgUSAS__kwa_g", "c_wasXBK__kwa_g", "c_wasXBS__kwa_g"); 
//Generate Weapon ID List
for($j = 0; $j < 88; $j++)
{
	$weaponIDList .= "'".$weaponIDArray[$j]."',";
}

//Remove last ,
$weaponIDList = substr($weaponIDList, 0, 1557);

//Get 3 Best Weapons
$topWeaponsSQL = 'SELECT statname,value FROM playerstats WHERE `pid` = "'.$pid.'" AND `statname` IN ('.$weaponIDList.') ORDER BY value DESC LIMIT 3';
$topWeaponsResult = $link->query($topWeaponsSQL);
$k = 0;
while ($row = mysqli_fetch_assoc($topWeaponsResult)) 
{
		//Remove "c_" and "__kwa_g"
		$topWeapons[$k]['weapon'] = substr(substr($row['statname'], 0 , -7), 2);
		$topWeapons[$k]['kills'] = $row['value'];
		$k++;
}

$vehiclesIDArray = array("c___ki_g", "c_mbtM1A__ki_g", "c_mbtT90__ki_g", "c_mtdM1128__ki_g", "c_ahAH1Z__ki_g", "c_vmaG__ki_g", "c_ahMi28__ki_g", "c_ifvLAV__ki_g", "c_trUH1__ki_g", "c_mtdSPRUTSD__ki_g", "c_jfF18__ki_g", "c_ifvBMP__ki_g", "c_aa9k22__ki_g", "c_trHum__ki_g", "c_jfSu35__ki_g", "c_martHIM__ki_g", "c_shz11__ki_g", "c_trAAV__ki_g", "c_trVod__ki_g", "c_trVDV__ki_g", "c_trITV__ki_g", "c_ifvBTR90__ki_g", "c_aaLAV__ki_g", "c_jfx1F35JSF__ki_g", "c_martBM23__ki_g", "c_trDpv__ki_g", "c_sKorn__ki_g", "c_shAH6__ki_g", "c_atTOW__ki_g", "c_trHmvM__ki_g", "c_trVodnxp5__ki_g", "c_vmaD__ki_g", "c_trSkid__ki_g", "c_trhmvnxp5__ki_g", "c_trKLR__ki_g", "c_trQB__ki_g", "c_trVanM__ki_g", "c_trRIB__ki_g", "c_jaA10__ki_g", "c_trKA60__ki_g", "c_saaPant__ki_g", "c_jaSU25__ki_g", "c_saaCRAM__ki_g", "c_trVodnM__ki_g");
//Generate vehicle ID List
for($j = 0; $j < 44; $j++)
{
	$vehiclesIDList .= "'".$vehiclesIDArray[$j]."',";
}
//Remove last ,
$vehiclesIDList = substr($vehiclesIDList, 0, 725);
//echo strlen($vehiclesIDList);

//Get 3 Best Vehicles
$topVehiclesSQL = 'SELECT statname,value FROM playerstats WHERE `pid` = "'.$pid.'" AND `statname` IN ('.$vehiclesIDList.') ORDER BY value DESC LIMIT 3';
$topVehiclesResult = $link->query($topVehiclesSQL);
$k = 0;
while ($row = mysqli_fetch_assoc($topVehiclesResult)) 
{
		//Remove "c_" and "__ki_g"
        $topVehicles[$k]['vehicle'] = substr(substr($row['statname'], 0 , -6), 2);
		$topVehicles[$k]['kills'] = $row['value'];
		$k++;
}

//Get stats from pid
$queryPlayerStats = 'SELECT * FROM playerstats WHERE `pid` = "'.$pid.'"';
$resultPlayerStats = $link->query($queryPlayerStats);
while ($row = mysqli_fetch_assoc($resultPlayerStats)) 
{
		$playerStats[$row['statname']]= $row['value'];
}

$rank = round($playerStats['rank']);

$stats['kills']	= round($playerStats['c___k_g']);

$stats['timeFormated']['s'] = round($playerStats['c___sa_g']);

$stats['timeFormated']['h'] = (integer)($stats['timeFormated']['s'] / 3600);
$stats['timeFormated']['m'] = (integer)(($stats['timeFormated']['s'] - 3600 * $stats['timeFormated']['h']) / 60);
$stats['timeFormated']['s'] = $stats['timeFormated']['s'] - (3600 * $stats['timeFormated']['h']) - (60 * $stats['timeFormated']['m']);

$stats['time'] = round($playerStats['c___sa_g']);

$sc_vehicleall = $playerStats['sc_vehiclembt'] + $playerStats['sc_vehicleifv'] + $playerStats['sc_vehicleaa'] + $playerStats['sc_vehicleah'] + $playerStats['sc_vehiclesh'] + $playerStats['sc_vehiclejet'] + $playerStats['sc_vehiclelbt'] + $playerStats['sc_vehicleart'];

$stats['score'] =  round($playerStats['sc_assault'] + $playerStats['sc_engineer'] + $playerStats['sc_support'] + $playerStats['sc_recon'] + $sc_vehicleall + $playerStats['sc_award'] + $playerStats['sc_unlock'] );
//$stats['score'] += $playerStats['sc_specialkit']  + $playerStats['sc_coop'];
$stats['score'] += $playerStats['sc_specialkit'];
$score =  $stats['score'];


//$kdr = round($playerStats['kdr'],2);
$kdr = round( $playerStats['c___k_g'] / $playerStats['c___d_g'],2);
$spm = round($score / ($playerStats['c___sa_g'] / 60));
$kpm = round($playerStats['c___k_g'] / ( $playerStats['c___sa_g'] / 60 ),2 );
	
$stats['as_sstar_count'] = number_format($playerStats['ssclbas_00']);	
$stats['eng_sstar_count'] = number_format($playerStats['ssclbe_00']);	
$stats['sup_sstar_count'] = number_format($playerStats['ssclbsu_00']);	
$stats['rec_sstar_count'] = number_format($playerStats['ssclbr_00']);	

$assault_progress = round((($playerStats['sc_assault'] - (220000 * $stats['as_sstar_count']))/220000)*100);
$engineer_progress = round((($playerStats['sc_engineer'] - (145000 * $stats['eng_sstar_count']))/145000)*100);
$support_progress = round((($playerStats['sc_support'] - (170000 * $stats['sup_sstar_count']))/170000)*100);
$recon_progress = round((($playerStats['sc_recon'] - (195000 * $stats['rec_sstar_count']))/195000)*100);
	
	
$stats['asScore'] = number_format($playerStats['sc_assault']);
$stats['enScore'] = number_format($playerStats['sc_engineer']);
$stats['spScore'] = number_format($playerStats['sc_support']);
$stats['rcScore'] = number_format($playerStats['sc_recon']);
$stats['squadScore'] = number_format($playerStats['sc_squad']);
$stats['vehicleScore'] = number_format($sc_vehicleall);
$stats['awardScore'] = number_format($playerStats['sc_award']);
$stats['unlockScore'] = number_format($playerStats['sc_unlock']);

$stats['deaths'] = number_format($playerStats['c___d_g']);
$stats['killAssists'] = number_format($playerStats['c___ka_g']);


$stats['wins'] = number_format($playerStats['c_mwin__roo_g']);
$stats['losses'] = number_format($playerStats['c_mlos__roo_g']);
$stats['shotsFired'] = number_format($playerStats['c___sfw_g']);
$stats['shotsHit'] = number_format($playerStats['c___shw_g']);
$stats['accuracy'] = number_format($playerStats['c___shw_g'] / $playerStats['c___sfw_g'], 2)*100;
$stats['headshots'] = number_format($playerStats['c___hsh_g']);
$stats['longestHeadshot'] = number_format($playerStats['c___hsd_ghva']);

$stats['repairs'] = number_format($playerStats['c___r_g']);
$stats['revives'] = number_format($playerStats['c___re_g']);
$stats['heals'] = number_format($playerStats['c___h_g']);
$stats['resupplies'] = number_format($playerStats['c___rs_g']);
$stats['avengerKills'] = number_format($playerStats['c___ak_g']);
$stats['saviorKills'] = number_format($playerStats['c___sk_g']);
$stats['suppressionAssists'] = number_format($playerStats['c___sua_g']);
$stats['dogtagsTaken'] = number_format($playerStats['c___dt_g']);
$stats['vehiclesDestroyed'] = number_format($playerStats['c_vA__de_g']);
$stats['highestKillStreak'] = number_format($playerStats['c___k_ghvs']);
$stats['nemesisKills'] = number_format($playerStats['c___nx_g']);
$stats['highestNemesisStreak'] = number_format($playerStats['c___nk_ghva']);

//Normalize Values to calc skill
$nSPM = $spm / 1000;
$nKPM = $kpm / 3;
$nKDR = $kdr / 5;

$skill = round((($nSPM * 0.6) + ($nKPM * 0.3) + ($nKDR * 0.1)) * 1000);


//Rank Data Processing
/*
$queryRankData = 'SELECT * FROM rankdata WHERE `rank` = "'.$rank.'"';
$resultRankData = $link->query($queryRankData);
$rankData = mysqli_fetch_array($resultRankData, MYSQLI_ASSOC);
*/

//nextRank
$nextRank = $rank +1;
/*
$queryNextRankData = 'SELECT * FROM rankdata WHERE `rank` = "'.$nextRank.'"';
$resultNextRankData = $link->query($queryNextRankData);
$nextRankData = mysqli_fetch_array($resultNextRankData, MYSQLI_ASSOC);
*/

function getRankName()
{

}

$levelScore = $score - $rankData[$rank]['score'];
if($rankData[$nextRank]['rankScore'] == 0)
{
	$progress = "100"; //Reached maximum level: there is no nextrank
}
else
{
	$progress = ($levelScore / $rankData[$nextRank]['rankScore']) * 100;
}
if($progress > 100){$progress = 100;}

//Calc skillBar position from left

if($skill > 1000)
{
	$skillBarPosition = 143; // Maximum minus half of pointer
}
elseif($skill < 25)
{
	$skillBarPosition = 0;
}
else
{
	$skillBarPosition = (($skill / 10)*1.5)-4;
}

$gravatar = $userDataFromPid['gravatar'];

$gravatar = $userDataFromPid['gravatar'];

if($userDataFromPid['name'] != "")
{
	$name = "(".$userDataFromPid['name'].")";
}
else
{
	$name = "";
}

$scoreLeft = $rankData[$nextRank]['rankScore'] - $levelScore;
?>


<div id="game-stats-head">
 <div class="pull-left">
 <div class="avatar-container"><a class="avatar large online" href="" style="background-image:url(img/avatars/default-avatar-60.png);"></a></div>
 
 
 
 <?php  
 if ($userDataFromPid['clantag'] != '')
 {
	echo "<h1 class='primary soldier-info-name'>";
	echo "<span class='premium'>[".$userDataFromPid['clantag']."]</span>";
	echo "<span class='premium'>".$userDataFromPid['dsnm']."</span>";
	echo "</h1>";
 }
 else
 {
	echo "<h1 class='primary soldier-info-name'>";
	echo "<span class='premium'>".$userDataFromPid['dsnm']."</span>";
	echo "</h1>";
 }
 ?>

 
 
 <!--<h1 class="primary soldier-info-name">
 <span class="premium"><?=$dsnm?></span></h1>-->
 
 <div class="user">

 <ul class="tag-icon-list">
 <li><a href=""><img src="./img/bf3.png"></a></li>
 <li><a href=""><img class="common-gameexpansion common-gameexpansion-262144" src="./img/262144.gif"></a></li>
 </ul>
 
 <i class="icon-platform pc "></i>
 <!--<a class="profile-link" href="">
 <a class="profile-link" href=".?action=settings"><span><?=$dsnm?><span lang="en"><?=$lang['settings']?></span></a>-->
 </div>
 </div>
 </div>
 
<div style="clear:both;"></div>
<nav class="submenu margin-top ">
 
 <ul>
 <li class="profile-stats-tab overview active"><a href=""><span lang="en"><?=$lang['Overview']?></span></a></li>
 <li class="profile-stats-tab"><a href="?action=equipment"><span lang="en"><?=$lang['Stats']?></span></a></li>
 <!--<li class="profile-stats-tab unlocks"><a>Unlocks</a></li>-->
 <!--<li class="profile-stats-tab loadout"><a href="">Loadout</a></li>-->
 <li class="profile-stats-tab"><a href=".?action=awards"><span lang="en"><?=$lang['Awards']?></span></a></li>
 <!--<li class="profile-stats-tab battlepacks"><a href="">BattlePacks</a></li>-->
 <li class="profile-stats-tab"><a href=".?action=dogtagsB"><span lang="en"><?=$lang['DogTags']?></span></a></li>
 <li class="profile-stats-tab assignments"><a href=".?action=assignments"><span lang="en"><?=$lang['Assignments']?></span></a></li>
 </ul>
   
 </nav>

 <div class="game-stats-content">
 <div id="profile-stats-fetch-url">
 
 <section id="overview-info">
 <div class="box"></div>
 <div class="row-tight" style="background-color: inherit">
 <div class="span2">
 <div class="overview-info-box box">
 <header><h1><span lang="en"><?=$lang['Rank']?></span></h1></header>
 <div class="box-content no-padding">
 <div id="overview-rank">
 <div class="bf4-rank rank medium r64 ">
 <img src="img/ranksMedium/<?php echo getRankImageName($rank); ?>.png" width="128" height="128">
 </div>
 
 <div class="rank-progress">
 <div class="progress-bar thick">
 <div id ="progress" class="warning progress-bar-inner" style="width: <?php echo $progress; ?>%;"></div>
 </div>
 
 <div class="progress-bar-info">
 <p class="progressName"><?php echo $rankData[$rank]['name'];?></p>
 <p><strong id="replay-rank-score"><?php echo number_format($levelScore); ?></strong> / <span id="replay-rank-max-score"><?php echo number_format($rankData[$nextRank]['rankScore']);?></span>
 </p>
 </div>

 </div>
 </div>
 
 </div>
 </div>
 <div class="overview-info-box small box ">
 <header><h1><span lang="en"><?=$lang['ServiceStars']?></span></h1></header>
 <div class="box-content no-padding">
 <ul class="overview-service-stars">
 <li class="servicestars-1">
 <li class="servicestars-1">
 <div class="kit-icon small kit-1"></div>
 <div class="progress-bar thickest animate">
 <div id="assault" class="warning progress-bar-inner assault" style="width: <?=$assault_progress?>%;"></div>
 </div>
 <div class="star-count">
 <span>
 <?=$stats['as_sstar_count']?></span>
 </div>
 </li>
  <li class="servicestars-2">
 <div class="kit-icon small kit-2"></div>
 <div class="progress-bar thickest animate">
 <div id="engineer" class="warning progress-bar-inner" style="width: <?=$engineer_progress?>%;"></div>
 </div>
 <div class="star-count">
 <span>
 <?=$stats['eng_sstar_count']?>
 </span>
 </div>
 </li>
 
 <li class="servicestars-32">
 <div class="kit-icon small kit-32"></div>
 <div class="progress-bar thickest animate">
 <div id="support" class="warning progress-bar-inner" style="width: <?=$support_progress?>%;"></div>
</div>
 <div class="star-count">
 <span>
 <?=$stats['sup_sstar_count']?>
 </span>
 </div>
 </li>
 
 <li class="servicestars-8">
 <div class="kit-icon small kit-8"></div>
 <div class="progress-bar thickest animate">
 <div id="recon" class="warning progress-bar-inner" style="width: <?=$recon_progress?>%;"></div>
 </div>
 <div class="star-count">
 <span>
 <?=$stats['rec_sstar_count']?>
 </span>
 </div>
 </li>
 
 <!--<li class="servicestars-2048">
 <div class="kit-icon small kit-2048"></div>
 <div class="progress-bar thickest animate">
 </div>
 <div class="star-count hide">
 <span></span>
 </div>-->
 </li>
 
 </ul>
 
 </div>
 </div>
 </div>
 <div class="span2">
 <div class="overview-skillcontainer">
 <div id="overview-skill" class="overview-info-box box">
 <header>
 <h1><span lang="en"><?=$lang['Skill']?></span></h1>
 </header>
 <div class="box-content no-padding">
 <p class="overviewskillvalue"><?php echo $skill;?></p><div class="overview-skill-bar">
 <div id="overview-skill-bar" style="width: 8px; left: <?php echo $skillBarPosition;?>px"></div>
 </div>
 </a>
 </div>
 </div>
 <ul id="overview-info-list" class="clearfix">
 
 <li>
 <span><?=$lang['K/D']?></span>
 <strong class="focus" id="stat-kd"><?php echo $kdr;?></strong>
 </li>
 <li>
 <span><?=$lang['SPM']?></span>
 <strong class="focus" id="stat-spm"><?php echo $spm;?></strong>
 </li>

 <li class="last">
 <span><?=$lang['KPM']?></span>
 <strong class="focus" id="stat-kpm"><?php echo $kpm;?></strong>
 </li>
 <li>
 
 <span><?=$lang['Kills']?></span>
 <strong id="stat-kills"><?php echo number_format($stats['kills']); ?></strong>
 </li>
 
 <li>
 <span lang="en"><?=$lang['Score']?></span>
 <strong id="stat-score"><?php echo number_format($stats['score']); ?></strong>
 </li>
 
 <li class="last">
 <span lang="en"><?=$lang['Time']?></span>
 <strong id="stat-time-played"><?php echo $stats['timeFormated']['h'].$lang['h'].$stats['timeFormated']['m'].$lang['m']; ?></strong>
 </li>
 
 </ul>
 </div>
 
 
 <div class="box overview-top-box">
 <header>
 <h1><span lang="en"><?=$lang['TopWeapons']?></span></h1>
 </header>
 <div class="box-content no-padding">
 <div class="item-highlighted">
 
 <div class="top-item is-linked">
 <div class="weapon_unlock medium" >
 <img style="width:200px; margin-top:38px; margin-left:24px" src="img/weapons/<?php echo $weaponsData[$topWeapons[0]['weapon']]['pic'] ?>.png">
 
 </div>
 <div class="info">
 <p class="title"><?php echo $weaponsData[$topWeapons[0]['weapon']]['name'] ?></p>
 <p class="score"><?php echo round($topWeapons[0]['kills'])?> <?=$lang['Kills']?></p>
 </div>
 </div>

 </div>
 <div class="items-highlighted">
 
 <div class="top-item is-linked">
 <div class="weapon_unlock xsmall">
 <img style="width:79px; height:43px; margin-top:22px" src="img/weapons/<?php echo $weaponsData[$topWeapons[1]['weapon']]['pic'] ?>.png" align="middle">
 </div>
 <div class="info">
 <p class="title"><?php echo $weaponsData[$topWeapons[1]['weapon']]['name'] ?></p>
 <p class="score"><?php echo round($topWeapons[1]['kills']) ?><?=$lang['Kills']?></p>
 </div>
 </div>
 
 <div class="top-item is-linked">
 <div class="weapon_unlock xsmall">
 <img style="width:79px; height:43px; margin-top:22px" src="img/weapons/<?php echo $weaponsData[$topWeapons[2]['weapon']]['pic'] ?>.png" align="middle">
 </div>

 <div class="info">
 <p class="title"><?php echo $weaponsData[$topWeapons[2]['weapon']]['name'] ?></p>
 <p class="score"><?php echo round($topWeapons[2]['kills']) ?><?=$lang['Kills']?></p>
 </div>
 </div>

 </div>
 </div>
 </div>
 </div>

 <div class="span2">
 <div id="overview-soldier" class="overview-info-box box">
 <header>
 <h1><span lang="en"><?=$lang['DogTags']?></span></h1>
 </header>
 <div class="box-content no-padding">
 
<div style="margin-left:24px; margin-top:50px" class="dogtags dogtags-chain horizontal">



 <?php 
 
 $dtb = $userDataFromPid['dtb'];
 $dta = $userDataFromPid['dta'];
 
 drawimg("dtb"."$dtb");
 drawimg("dta"."$dta");
 ?>
 
 <div class="dog-tag-name-overlay">
 <p><?=$userDataFromPid['dsnm']?></p>
 </div>
 </div>

 </div>
 </div>
 
 <div class="box overview-top-box">
 <header>
 <h1><span lang="en"><?=$lang['TopVehicles']?></span></h1>
 </header>
 <div class="box-content no-padding">
 <div class="item-highlighted">
 <div class="top-item is-linked">
 <div class="vehicle_unlock medium item-image ">
 <img style="margin-left: 10px; margin-top: 13px; width: 231px" class="weaponImageBig" src="img/vehicles/<?php echo $vehiclesData[$topVehicles[0]['vehicle']]['pic'] ?>.png" align="middle">
 </div>

 <div class="info">
 <p class="title"><?php echo $vehiclesData[$topVehicles[0]['vehicle']]['name'] ?></p>
 <p class="score"><?php echo round($topVehicles[0]['kills']) ?><?=$lang['Kills']?></p>
 </div>
 </div>

 </div>
 <div class="items-highlighted">
 <div class="top-item is-linked">
 <div class="vehicle_unlock xsmall item-image ">
 <img style="width:76px; margin-left: -1px; margin-top:12px" class="weaponImageBig" src="img/vehicles/<?php echo $vehiclesData[$topVehicles[1]['vehicle']]['pic'] ?>.png" align="middle">
 </div>

 <div class="info">
 <p class="title"><?php echo $vehiclesData[$topVehicles[1]['vehicle']]['name'] ?></p>
 <p class="score"><?php echo round($topVehicles[1]['kills']) ?><?=$lang['Kills']?></p>
 </div>
 </div>
 
 <div class="top-item is-linked">
 <div class="vehicle_unlock xsmall item-image ">
 <img style="width:76px; margin-left: -1px; margin-top:12px" class="weaponImageBig" src="img/vehicles/<?php echo $vehiclesData[$topVehicles[2]['vehicle']]['pic'] ?>.png" align="middle">
 </div>
 <div class="info">
 <p class="title"><?php echo $vehiclesData[$topVehicles[2]['vehicle']]['name'] ?></p>
 <p class="score"><?php echo round($topVehicles[2]['kills']) ?><?=$lang['Kills']?></p>
 </div>
 </div>

 </div>
 </div>
 </div>
 
 </div>
</div>
</section>

 
 
 
 <section id="stats-detailed">
 <div class="row">
 <div class="span4">
 <div class="box">
 <header><h1><span lang="en"><?=$lang['MultiplayerScore']?></span></h1></header>
 </div>
 <table class="table">
 <tbody>
 
 <tr class="" style="height:36px">
 <td class="name"></td>
 <td class="score">
 </td>
 </tr>
 
 <tr class="assault">
 <td class="name"><span lang="en"><?=$lang['AssaultScore']?></span></td>
 <td class="score">
 <?php echo $stats['asScore']; ?>
 </td>
 </tr>
 <tr class="engineer">
 <td class="name"><span lang="en"><?=$lang['EngineerScore']?></span></td>
 <td class="score">
 <?php echo $stats['enScore']; ?>
 </td>
 </tr>
 <tr class="support">
 <td class="name"><span lang="en"><?=$lang['SupportScore']?></span></td>
 <td class="score">
 <?php echo $stats['spScore']; ?>
 </td>
 </tr>
 <tr class="recon">
 <td class="name"><span lang="en"><?=$lang['ReconScore']?></span></td>
 <td class="score">
 <?php echo $stats['rcScore']; ?>
 </td>
 </tr>
 
 <!--<tr class="commander">
 <td class="name"><span lang="en"><?=$lang['CommanderScore']?></span></td>
 <td class="score">
 -
 </td>
 </tr>-->
 
 
 <tr class="sc_squad">
 <td class="name"><span lang="en"><?=$lang['SquadScore']?></span></td>
 <td class="score">
 <?php echo $stats['squadScore']; ?>
 </td>
 </tr>
 <tr class="sc_vehicle">
 <td class="name"><span lang="en"><?=$lang['VehicleScore']?></span></td>
 <td class="score">
 <?php echo $stats['vehicleScore']; ?>
 </td>
 </tr>
 <tr class="sc_award">
 <td class="name"><span lang="en"><?=$lang['AwardScore']?></span></td>
 <td class="score">
 <?php echo $stats['awardScore']; ?>
 </td>
 </tr>
 <tr class="sc_unlock">
 <td class="name"><span lang="en"><?=$lang['UnlockScore']?></span></td>
 <td class="score">
 <?php echo $stats['unlockScore']; ?>
 </td>
 </tr>
 
 
 
 <tr class="scorePerMinute">
 <td class="name"><span lang="en"><?=$lang['Score/Min']?></span></td>
 <td class="score">
 <?php echo $spm;?>
 </td>
 </tr>
 
 <tr class="" style="height:37px">
 <td class="name"></td>
 <td class="score">
 </td>
 </tr>
 
 <tr class="totalScore">
 <td class="name"><span lang="en"><?=$lang['TotalScore']?></span></td>
 <td class="score">
 <?php echo number_format($stats['score']); ?>
 </td>
 </tr>
 
 </tbody>
 </table>
 </div>
 <div class="span4" style="margin-left: 10px">
 <div class="box">
 <header><h1><span lang="en"><?=$lang['General']?></span></h1></header>
 </div>
 <table class="table">
 <tbody>
 
 <tr class="kills">
 <td class="name"><span lang="en"><?=$lang['Kills']?></span></td>
 <td class="score">
 <?php echo number_format($stats['kills']); ?>
 </td>
 </tr>
 <tr class="deaths">
 <td class="name"><span lang="en"><?=$lang['Deaths']?></span></td>
 <td class="score">
 <?php echo $stats['deaths']; ?>
 </td>
 </tr>
 <tr class="killAssists">
 <td class="name"><span lang="en"><?=$lang['KillAssists']?></span></td>
 <td class="score">
 <?php echo $stats['killAssists']; ?>
 </td>
 </tr>
 <tr class="kdRatio">
 <td class="name"><span lang="en"><?=$lang['K/Dratio']?></span></td>
 <td class="score">
 <?php echo $kdr;?>
 </td>
 </tr>
 <tr class="killsPerMinute">
 <td class="name"><span lang="en"><?=$lang['Kills/Min']?></span></td>
 <td class="score">
 <?php echo $kpm;?>
 </td>
 </tr>
 <tr class="numWins">
 <td class="name"><span lang="en"><?=$lang['Wins']?></span></td>
 <td class="score">
 <?php echo $stats['wins']; ?>
 </td>
 </tr>
 <tr class="numLosses">
 <td class="name"><span lang="en"><?=$lang['Losses']?></span></td>
 <td class="score">
 <?php echo $stats['losses']; ?>
 </td>
 </tr>
 <tr class="shotsFired">
 <td class="name"><span lang="en"><?=$lang['ShotsFired']?></span></td>
 <td class="score">
 <?php echo $stats['shotsFired']; ?>
 </td>
 </tr>
 <tr class="shotsHit">
 <td class="name"><span lang="en"><?=$lang['ShotsHit']?></span></td>
 <td class="score">
 <?php echo $stats['shotsHit']; ?>
 </td>
 
 </tr>
 <tr class="accuracy">
 <td class="name"><span lang="en"><?=$lang['Accuracy']?></span></td>
 <td class="score">
 <?php echo $stats['accuracy']; ?>%
 </td>
 </tr>
 
 </tr>
 <tr class="headshots">
 <td class="name"><span lang="en"><?=$lang['Headshots']?></span></td>
 <td class="score">
 <?php echo $stats['headshots']; ?>
 </td>
 </tr>
 
 <tr class="headshots">
 <td class="name"><span lang="en"><?=$lang['LongestHeadshot']?></span></td>
 <td class="score">
 <?php echo $stats['longestHeadshot']; ?> <?=$lang['m1']?>
 </td>
 </tr>
  
 </tbody>
 </table>
 </div>
  
 <div class="span4" style="margin-left: 12px">
 <div class="box">
 <header><h1><span lang="en"><?=$lang['Team']?></span></h1></header>
 </div>
 <table class="table">
 <tbody>
 <tr class="repairs">
 <td class="name"><span lang="en"><?=$lang['Repairs']?></span></td>
 <td class="score">
 <?php echo $stats['repairs']; ?>
 </td>
 </tr>
 <tr class="revives">
 <td class="name"><span lang="en"><?=$lang['Revives']?></span></td>
 <td class="score">
 <?php echo $stats['revives']; ?>
 </td>
 </tr>
 <tr class="heals">
 <td class="name"><span lang="en"><?=$lang['Heals']?></span></td>
 <td class="score">
 <?php echo $stats['heals']; ?>
 </td>
 </tr>
 <tr class="resupplies">
 <td class="name"><span lang="en"><?=$lang['Resupplies']?></span></td>
 <td class="score">
 <?php echo $stats['resupplies']; ?>
 </td>
 </tr>
 <tr class="avengerKills">
 <td class="name"><span lang="en"><?=$lang['AvengerKills']?></span></td>
 <td class="score">
 <?php echo $stats['avengerKills']; ?>
 </td>
 </tr>
 <tr class="saviorKills">
 <td class="name"><span lang="en"><?=$lang['SaviorKills']?></span></td>
 <td class="score">
 <?php echo $stats['saviorKills']; ?>
 </td>
 </tr>
 <tr class="suppressionAssists">
 <td class="name"><span lang="en"><?=$lang['SuppressionAssists']?></span></td>
 <td class="score">
 <?php echo $stats['suppressionAssists']; ?>
 </td>
 </tr>
 <tr class="dogtagsTaken">
 <td class="name"><span lang="en"><?=$lang['DogtagsTaken']?></span></td>
 <td class="score">
 <?php echo $stats['dogtagsTaken']; ?>
 </td>
 </tr>
 <tr class="vehiclesDestroyed">
 <td class="name"><span lang="en"><?=$lang['VehiclesDestroyed']?></span></td>
 <td class="score">
 <?php echo $stats['vehiclesDestroyed']; ?>
 </td>
 </tr>
 
 <tr class="killStreakBonus">
 <td class="name"><span lang="en"><?=$lang['HighestKillStreak']?></span></td>
 <td class="score">
 <?php echo $stats['highestKillStreak']; ?>
 </td>
 </tr>
 
 <tr class="nemesisKills">
 <td class="name"><span lang="en"><?=$lang['NemesisKills']?></span></td>
 <td class="score">
 <?php echo $stats['nemesisKills']; ?>
 </td>
 </tr>
 
 <tr class="nemesisStreak">
 <td class="name"><span lang="en"><?=$lang['HighestNemesisStreak']?></span></td>
 <td class="score">
 <?php echo $stats['highestNemesisStreak']; ?>
 </td>
 </tr>
 
 
 
 </tbody>
 </table>
 </div>
  
 </div>
</section>
 
 
 <!--
<section id="overview-completion">
 <div class="box">
 <header>
 <h1>Completion Level</h1>
 </header>
 <div class="box-content no-padding">


 <ul>
 <li class="clearfix">
 <a href="/bf4/campaign/880383959/1/">
 <div class="completion-content">
 <h6>Campaign</h6>
 <p class="completed">
 7 / 7
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:100%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/assignments/880383959/1/">
 <div class="completion-content">
 <h6>Assignments</h6>
 <p>
 34 / 108
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:31%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/awards/880383959/1/">
 <div class="completion-content">
 <h6>Medals</h6>
 <p>
 15 / 54
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:27%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/awards/880383959/1/">
 <div class="completion-content">
 <h6>Ribbons</h6>
 <p>
 38 / 54
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:70%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/weaponunlocks/880383959/1/">
 <div class="completion-content">
 <h6>Weapons</h6>
 <p>
 112 / 153
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:73%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/vehicleunlocks/880383959/1/">
 <div class="completion-content">
 <h6>Vehicle Unlocks</h6>
 <p class="completed">
 105 / 105
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:100%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/kits/880383959/1/">
 <div class="completion-content">
 <h6>Kits</h6>
 <p>
 50 / 51
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:98%"></div>
</div>

 </div>
 </a>
 </li>
  <li class="clearfix">
 <a href="/bf4/soldier/NorthRobocop/dogtags/880383959/1/">
 <div class="completion-content">
 <h6>Dog Tags</h6>
 <p>
 331 / 719
 </p>
 


<div class="progress-bar thicker">
 <div class="warning progress-bar-inner" style="width:46%"></div>
</div>

 </div>
 </a>
 </li>
 
 </ul>
 </div>
 </div>
</section>
-->
</div>
</div>

 <!--</section>-->


<br><br><br><br>
 

<?php mysqli_close($link); ?>


